package PenTest.xiaohongshu.ACM0409;

import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Acm1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int n = Integer.parseInt(str.split(" ")[0]);
        int k = Integer.parseInt(str.split(" ")[1]);
        PriorityQueue<int[]> queue = new PriorityQueue<>(new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                return o2[0] - o1[0];//[0]为分数，[1]为index
            }
        });
        for (int i = 1; i <= n; i++) {
            str = scanner.nextLine();
            int score = Integer.parseInt(str.split(" ")[0])+Integer.parseInt(str.split(" ")[1])*2;
            queue.offer(new int[]{score, i});
        }
        int[] arr = new int[k];
        for (int i = 0; i < k ; i++) {
            arr[i] = queue.poll()[1];
        }
        Arrays.sort(arr);
        for (int i = 0; i < k; i++) {
            System.out.printf("%d ",arr[i]);
        }
    }
}
